% 2015 PLAGIOCLASE-LIQUID HYGROMETER
%WATERS, L.E. AND LANGE, R.A. for American Mineralogist: October 2015 Deposit AM-15-105232 
 
%READ ME
% The following code contains the equations to calculate the activities of
% anorthite and albite in plagioclase, dissolved wt% H2O in melt, and can be
% used to calculate pre-eruptive temperature.
 
% The spreadsheet cannot be configured to solve for temperature directly,
% because the activities of anorthite and albite are configured as a
% function of temperature, therefore, calculations of temperatures must be
% iterative.
 
% TO USE: Please crease a .csv or .xlsx file entitled "input_data" and save
% it to the directory in which this code is saved. The input_data file must
% contain the following 13 values, in the following order, with no headers:
 
% (1)  XAn
% (2)  XAb
% (3)  TempC (in Celsius)
% (4)  Pbars
% (5)  wtSiO2
% (6)  wtTiO2
% (7) wtAl2O3
% (8) wtFe2O3T 
% (9) wtFeOT
% (10) wtMgO
% (11) wtCaO
% (12) wtNa2O
% (13) wtK2O
 
 
% Please also create a second file entitled "results.csv". This is where 
% the results will be reported, without headers, in the following order:
 
% (1)  XAn,     (2)  XAb,     (3)  Aan,    (4) Aab,     (5) Temp C,
% (6)  Pbars,   (7)  wtSiO2,  (8)  wtTiO2, (9) wtAl2O3, (10) wtFe2O3T, 
% (11) wtFeOT,  (12) wtMgO,   (13) wtCaO,  (14) wtNa2O, (15) wtK2O, 
% (16) wtH2Ocalc
 
% Please note that NEW VALUES returned by the MatLab Code are:
 
% Aan (the activity of the anorthite component in plagioclase) in Column 3,
% Aab (the activity of the albite component in plagioclase) in Column 4,
% wtH2Ocalc (the calculated wt% H2O in equilibrium with the melt in Column
% 16).
 
% Please do not hesitate to contact Laura Waters if any assistance is
% needed at the following email address (laura.e.waters@gmail.com).
% Rebecca Lange may also be reached at becky@umich.edu.
 
% Thanks for your interest!